package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.WorkTypeMapper;
import com.ruoyi.system.domain.WorkType;
import com.ruoyi.system.service.IWorkTypeService;

/**
 * 工种Service业务层处理
 * 
 * @author sizegang
 * @date 2024-06-29
 */
@Service
public class WorkTypeServiceImpl implements IWorkTypeService 
{
    @Autowired
    private WorkTypeMapper workTypeMapper;

    /**
     * 查询工种
     * 
     * @param id 工种主键
     * @return 工种
     */
    @Override
    public WorkType selectWorkTypeById(Long id)
    {
        return workTypeMapper.selectWorkTypeById(id);
    }

    /**
     * 查询工种列表
     * 
     * @param workType 工种
     * @return 工种
     */
    @Override
    public List<WorkType> selectWorkTypeList(WorkType workType)
    {
        return workTypeMapper.selectWorkTypeList(workType);
    }

    /**
     * 新增工种
     * 
     * @param workType 工种
     * @return 结果
     */
    @Override
    public int insertWorkType(WorkType workType)
    {
        workType.setCreateTime(DateUtils.getNowDate());
        return workTypeMapper.insertWorkType(workType);
    }

    /**
     * 修改工种
     * 
     * @param workType 工种
     * @return 结果
     */
    @Override
    public int updateWorkType(WorkType workType)
    {
        workType.setUpdateTime(DateUtils.getNowDate());
        return workTypeMapper.updateWorkType(workType);
    }

    /**
     * 批量删除工种
     * 
     * @param ids 需要删除的工种主键
     * @return 结果
     */
    @Override
    public int deleteWorkTypeByIds(Long[] ids)
    {
        return workTypeMapper.deleteWorkTypeByIds(ids);
    }

    /**
     * 删除工种信息
     * 
     * @param id 工种主键
     * @return 结果
     */
    @Override
    public int deleteWorkTypeById(Long id)
    {
        return workTypeMapper.deleteWorkTypeById(id);
    }
}
